package com.css.zfzx.data.thirdary.ftpReconciliation.repository;

import com.css.zfzx.data.thirdary.ftpReconciliation.repository.entity.SjtgfFjghshDzSgysjbEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.time.LocalDateTime;
import java.util.Date;

/**
 * @author leon
 * @date 2021/1/18 16:34
 */
@Repository
public interface FtpReconciliationRepository extends JpaRepository<SjtgfFjghshDzSgysjbEntity,String> {
    /**
     * 查询当前数据库时间
     *
     * @return
     */
    @Query(nativeQuery = true, value = "select SYSDATE();")
    Date getTimeNow();

    @Query(value = "select createtime from sjtgf_fjghsh_dz_sgysjb where updatetime is null and sjdxxhmc like " +
            ":sjdxxhmc order by createtime desc LIMIT 1",
            nativeQuery = true)
    LocalDateTime findCreateTime(String sjdxxhmc);

    @Query(value = "select updatetime from sjtgf_fjghsh_dz_sgysjb where sjdxxhmc like :sjdxxhmc order by updatetime desc LIMIT 1",
            nativeQuery = true)
    LocalDateTime findUpdateTime(String sjdxxhmc);

}
